function gitClone() {
    if [ ! -d ${gitRepoHub}/${sequence}/${gitRepoHome} ]
        then
            mkdir -p ${gitRepoHub}/${sequence}
            cmd="git clone -b ${gitRepoBranch} ${gitRepoUrl} ${gitRepoHub}/${sequence}/${gitRepoHome}"
            logger "${barRightArrow30}"
            logger "${cmd}"
            logger "${barLeftArrow30}"
            ${cmd}
        else
            logger "Dir already exits ${gitRepoRoot}"
            exit 1
    fi
}

function gitCloneForce() {
    if [ -d ${gitRepoHub}/${sequence}/${gitRepoHome} ]; then
        rm -rf ${gitRepoHub}/${sequence}/${gitRepoHome}
    fi
    gitClone
}

function gitDiff(){

    if [ ! -d ${gitRepoHub}/${sequence}/${gitRepoHome}  ];  then
        logger "Dir not found ${gitRepoHub}/${sequence}/${gitRepoHome} "
        return 1
    fi
    cd ${gitRepoHub}/${sequence}/${gitRepoHome}

    lastTag=${gitRepoBranchLastTime}
    thisTag=${gitRepoBranch}
    logger "Notice ${thisTag} is remotes/${gitRemoteRepoAlias}/${thisTag}"
    logger "Notice ${lastTag} is remotes/${gitRemoteRepoAlias}/${lastTag}"
    cmd="git diff remotes/origin/${lastTag} remotes/origin/${thisTag}"
    logger "${cmd}"
    ${cmd} | grep 'diff --git' | awk '{print $3}' | sed -r -n 's|a/(.*)|\1|p' | tee git_diff_${lastTag}_${thisTag}.lst

}

#function sshGitClone () {
#
#    set +e
#    ssh ${user}@${host} "
#    action=${action}
#    targetResource=${targetResource}
#    sequence=${sequence}
#    executeProfile=${executeProfile}
#    gitRepoHub=${gitRepoHub}
#    gitRepoHome=${gitRepoHome}
#    gitRepoUrl=${gitRepoUrl}
#    gitRepoBranch=${gitRepoBranch}
#    gitRemoteRepoAlias=${gitRemoteRepoAlias}
#    barRightArrow30='${barRightArrow30}'
#    barLeftArrow30='${barLeftArrow30}'
#    $(typeset -f checkIpAddress)
#    $(typeset -f checkUser)
#    $(typeset -f checkRevoker)
#    $(typeset -f logger)
#    $(typeset -f gitClone)
#    gitClone
#    "
#    if [[ ! $? == 0 ]]; then return 1; logger "Ssh gitClone failed." "error"; fi
#    logger "Ssh gitClone succeed."
#    set -e
#    return 0
#}
#
#function sshGitCloneForce () {
#
#    set +e
#    ssh ${user}@${host} "
#    action=${action}
#    targetResource=${targetResource}
#    sequence=${sequence}
#    executeProfile=${executeProfile}
#    gitRepoHub=${gitRepoHub}
#    gitRepoHome=${gitRepoHome}
#    gitRepoUrl=${gitRepoUrl}
#    gitRepoBranch=${gitRepoBranch}
#    gitRemoteRepoAlias=${gitRemoteRepoAlias}
#    barRightArrow30='${barRightArrow30}'
#    barLeftArrow30='${barLeftArrow30}'
#    $(typeset -f checkIpAddress)
#    $(typeset -f checkUser)
#    $(typeset -f checkRevoker)
#    $(typeset -f logger)
#    $(typeset -f gitClone)
#    $(typeset -f gitCloneForce)
#    gitCloneForce
#    "
#    if [[ ! $? == 0 ]]; then return 1; logger "Ssh gitCloneForce failed." "error"; fi
#    logger "Ssh gitCloneForce succeed."
#    set -e
#    return 0
#}
#
#function sshGitDiff () {
#
#    set +e
#    ssh ${user}@${host} "
#    action=${action}
#    targetResource=${targetResource}
#    sequence=${sequence}
#    executeProfile=${executeProfile}
#    gitRepoHub=${gitRepoHub}
#    gitRepoHome=${gitRepoHome}
#    gitRepoUrl=${gitRepoUrl}
#    gitRepoBranch=${gitRepoBranch}
#    gitRemoteRepoAlias=${gitRemoteRepoAlias}
#    barRightArrow30='${barRightArrow30}'
#    barLeftArrow30='${barLeftArrow30}'
#    $(typeset -f checkIpAddress)
#    $(typeset -f checkUser)
#    $(typeset -f checkRevoker)
#    $(typeset -f logger)
#    $(typeset -f gitDiff)
#    gitDiff
#    "
#    if [[ ! $? == 0 ]]; then return 1; logger "Ssh gitDiff failed." "error"; fi
#    logger "Ssh gitDiff succeed."
#    set -e
#    return 0
#}